<?php
namespace app\common\model;

use think\Model;

class User extends Model
{

    /**
     * @param array $where
     * @return array|false|\PDOStatement|string|Model
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function findUser(array $where=[])
    {
        return $this->where($where)->find();
    }

    public function countUser(array $where=[])
    {
        return $this->where($where)->count();
    }

    /**
     * @param array $where
     * @param bool $pageSize
     * @param array $pageconfig
     * @param bool $fields
     * @param string $order
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    public function selectUser(array $where=[], $pageSize=false, array $pageconfig=[], $fields=false, $order='id desc')
    {
        return $this->where($where)->field($fields)->order($order)->paginate($pageSize, false, $pageconfig);
    }
}